package com.elite.service;

import com.elite.dao.UserMapper;
import com.elite.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by hbl on 2017/1/13.
 */
@Service("UserService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * ע��ʱ�������ݱ��浽���ݿ�
     * @param user
     */
    @Override
    public void addUser(User user) {
        userMapper.insert(user);
    }

    /**
     * ʵ�ֽӿ��е�selectByPhone��������
     * @param phone
     * @return
     */
    @Override
    public List<User> selectByPhone(String phone) {
        return userMapper.selectByPhoneNum(phone);
    }

    @Override
    public void update(User userRecord) {
       userMapper.updateByPrimaryKeySelective(userRecord);
    }

    @Override
    public User selectById(Integer userId) {
        return userMapper.selectByPrimaryKey(userId);
    }
}
